home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
INFO
/
DOSTIPS4.ZIP
/
DOSCOLOR.TXT
< prev
next >
Wrap
Text File
|
1986-06-28
|
9KB
|
261 lines
Four Screens, No Waiting
(PC Magazine Vol 5 No 11 June 10, 1986 User-to-User)
The color/graphics (CGA) and enhanced graphics (EGA) adapters
allow multiple text-mode display pages. These extra pages can be used
from within your programs to perform "instant" screen updates. They
can also be used from within DOS to store screen output you don't want
to lose while running other programs.
In 80-column text modes, the CGA cards gives you four screen pages
numbered 0-3. Since nongraphics programs generally use only the active
display page, anything stored on the other display pages will usually
not be overwritten (although certain word processing programs may use
more than one screen page).
However, there is no convenient way from within DOS to switch
display pages. You can use the following SCRIPT1 file to create
PAGE.COM. Be sure to leave a blank line before RCX and hit the Enter
key after each line, especially the last one:
A
MOV AL,[005D]
AND AL,4F
SUB AL,37
JNB 010B
ADD AL,37
MOV AH,05
INT 10
INT 20
RCX
11
N PAGE.COM
W
Q
Then type:
DEBUG < SCRIPT1
to create the program. You invoke PAGE.COM at the DOS prompt by
entering PAGE n, where n is teh single-digit page number. For the
CGA, n will be a number from 0 to 3 with 0 as the DOS default.
An additional problem is that if you start to use the extra
display pages under DOS 3.x, you'll notice that the DOS command CLS
does not work quite right. If you are in a display page other than
page 0, CLS will blank the screen but place the cursor somewhere other
than where it belongs in the upper-left-hand corner. While it is
possible to write a short assembly language program to clear the
screen in the way you'd like, a better solution may be to patch
COMMAND.COM so that CLS does what it ought to.
To patch the DOS 3.1 version of COMMAND.COM, use the following
SCRIPT2 file. Again, be sure to leave a blank line near the end after
the RET, and hit the Enter key after each line:
A 262C
MOV AH,0F
INT 10
MOV CX,AX
MOV AH,02
XOR DX,DX
INT 10
MOV DL,CH
DEC DL
MOV DH,18
XOR CX,CX
MOV AX,0600
MOV BX,0700
INT 10
MOV BX,0
MOV AH,0B
INT 10
RET
W
Q
Then, to repair your copy (do not use the original!) of COMMAND.COM:
DEBUG COMMAND.COM < SCRIPT2
With DOS 3.1, the CLS command will clear 26 lines rather than the
standard 25. Therefore, if you run a program that uses extra video
pages, which is important if you are using the extra pages provided by
PAGE.COM, you may find the first line of an extra page mysteriously
erased. To fix this bug, make sure DEBUG and a copy (not the original!)
of DOS 3.1 COMMAND.COM are on the same disk and type:
DEBUG COMMAND.COM
E 263B 18
W
Q
In addition, you can customize COMMAND.COM so that CLS will set
the screen to any color. This will work on both the standard and
enhanced color graphics cards, and on the PC and AT. If you don't
mind a black border, just use the DEBUG command to edit the DOS 3.1
screen attribute byte:
A>DEBUG COMMAND.COM
-E 2642 1E
-W
Writing 4580 bytes
-Q
With this patch the screen reverts to bright yellow text on a blue
background whenever you type in CLS. You will no longer need a small
COM file or ANSI.SYS to run DOS in color. If you do use ANSI.SYS, the
patch will be overridden.
Use the following patch to change the border colors for DOS 3.1:
A>DEBUG COMMAND.COM
-E 2642 1E
-M CS:2632 264E CS:262C
-A 2649
xxxx:2649 MOV BL,01
xxxx:264B MOV AH,0B
xxxx:264D
-W
Writing 5AAA bytes
-Q
The before and after CLS addresses for DOS 3.1 are:
Location of Address of Screen Address of Border
CLS Command Attribute Byte Attribute Byte
Before: 262C-264F 2642
After : 263C 264A
The border patch won't work on an EGA configured for the high-
resolution 640 by 370 mode; BIOS prevents a border color from being
set in this mode. It can be set, however, if the standard RGB monitor
is attached.
If you are using a patched version of COMMAND.COM and are prompted
to insert a disk containing COMMAND.COM in drive A:, you must insert a
disk containing the patched version.
The two-chracter hex attribute byte stores the foreground as the
rightmost character and the background as the leftmost character. Pick
a hex number from 0 to F for each, where 0 = black, 1 = blue, 2 = green,
3 = light blue (cyan), 4 = red, 5 = purple (magenta), 6 = either brown
or yellow depending on your monitor, 7 = grayish white, 8 = dark gray,
9 = bright blue, A = bright green, B = bright light blue, C = bright
red, D = bright purple, E = bright yellow, and F = overintense white.
So green text on a purple background would be 52, and bright red text
on a light blue background would be 3C. The border color is obviously
just a single character from the above list.
SCRIPT2 is for DOS 3.1 only. To have CLS produce bright yellow
text on a blue background with a red border, change the:
MOV BX,0700
instruction to:
MOV BX,1E00
and change the:
MOV BX,0
instruction to:
MOV BX,0004
If you're using DOS 3.0, the only change that needs to be made is
in the first line. The line:
A 262C
should be changed to:
A 2412
Another alternative is to use PAGER.BAS below to patch DOS 3.1
COMMAND.COM (a copy, not the original!) and create the PAGE.COM
utility at the same time.
100 'PAGER.BAS
110 OPEN "COMMAND.COM" AS #1 LEN=1:FIELD #1,1 AS D$
120 FOR A=4284 TO 4286:GET 1,A:V$=V$+D$:NEXT:IF V$="3.1" THEN 140
130 PRINT "Retry with DOS 3.1 COMMAND.COM on this disk!":CLOSE:END
140 FOR A=1 TO 35:READ A$:LSET D$=CHR$(VAL("&H"+A$))
150 PUT #1,A+9516:NEXT:OPEN "PAGE.COM" AS #2 LEN=1:FIELD #2,1 AS D$
160 FOR A=1 TO 17:READ A$:LSET D$=CHR$(VAL("&H"+A$)):PUT #2:NEXT
170 CLOSE:PRINT "COMMAND.COM patched and PAGE.COM created.":END
180 DATA B4,0F,CD,10,89,C1,B4,02,31,D2,CD,10,88,EA,FE,CA,B6,18
190 DATA 31,C9,B8,00,06,BB,00,07,CD,10,BB,00,00,B4,0B,CD,10
200 DATA A0,5D,00,24,4F,2C,37,73,02,04,37,B4,05,CD,10,CD,20
-----------------------------------------------------------------
PC A La Mode
(PC Magazine Vol 5 No 12 June 24, 1986 User-to-User)
The normal boot routine usually puts systems with color/graphics
adapters into color text mode even if a black-and-white monitor is
attached. This forces users with black-and-white monitors to use the
DOS MODE BW command to change the mode so that color text can be read
properly. Because many user programs, such as SideKick, check the
video mode when loading to decide whether or not to use color in their
own direct screen updates, it is important to ensure that this black-
and-white video mode is properly selected before such memory-resident
routines are loaded.
However, while it's easy to put such a MODE command in an
AUTOEXEC.BAT file, such files can become irritatingly long. And each
time the system boots it has to grind through the MOD switch. One way
to avoid this is to make your boot programs set your video mode to
suit your monitor. To do this, use DEBUG version 2.0 or later to
modify the boot record on a bootable system disk in drive A:. First,
load DEBUG and type:
L 100 0 0 1
to load the drive A: boot record. Then type:
U 100 101
to display the initial JMP. You'll see something like JMP 012B. Write
down the hex number after the JMP. Then type:
A 100
to get into DEBUG's miniassembler. Follow this with:
MOV AX,2
INT 10
hitting Enter after each. Then, substituting the number you wrote down
at the beginning of this process for the xxxx, type:
JMP xxxx
and hit the Enter key twice. Finally, to make the change permanent:
W 100 0 0 1
to write it to the disk in drive A:, and then to quit, type:
Q
Be sure to hit Enter after each line.
You can use the DOS SYS.COM program to copy this updated boot
record to other disks you use for booting up the system. This
technique works with all versions of DOS. The new instructions are
written over the boot program's name, which serves no real function.
Editor's Note: Whenever you use DEBUG's Write command, be
extremely careful. Writing to 0 means drive A:, 1 means drive B:,
and 2 means drive C:. If you load data off a floppy and write it
back to a hard disk, you can create all sorts of trouble.
The technique above uses service 0 of BIOS Interrupt H10 to set
the video mode. You can experiment with this and boot your system
into different modes by changing the MOV AX,2 instruction. Replacing
the 2 with a 0 or 1 yields 40-width screens (the first in B&W, the
second in color). An AX of 2 (as above) boots the system up in 80-
width B&W, while 3 yields 80-width color. A value of 4 gives medium-
resolution color graphics; 5 yields medium-resolution B&W graphics;
6 sets the high-resolution screen. A 7 is especially for mono. Other
high-number modes are for the PCjr and/or the EGA.